package com.globalwave.pos.sale.entity;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import com.globalwave.base.BaseEntity;
import com.globalwave.customer.entity.CustomerProfile;
import com.globalwave.pos.payment.entity.PaymentLine;


/**
 * The persistent class for the INVENTORY_ON_HAND_BALANCE database table.
 * 
 */
@Entity
@Table(name="Sales_Order")
public class SalesOrder extends BaseEntity {
	private static final long serialVersionUID = 1L;
	public static final String SESSION_ID = "ORD$SES$Xxy435bm";

	
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="increment")
    @GenericGenerator(name="Sales_Order_ID_SEQ", strategy = "increment")
  private Long     id                 ;
  private Long     oid                ;
  private String   region_code        ;
  private String   shop_code          ;
  private String   terminal_code      ;
  private String   staff_number       ;
  private Long     subscriber_number  ;
  private Short   subscriber_type    ;
  private String   channel_           ;
  private Short   type_              ;
  private Integer  sale_date          ;
  private Timestamp     order_timestamp ;
  private Integer  pos_daily_seq      ;
  private Short    status_            ;
  private Short    order_progrss      ;
  private Integer   payer_number      ;
  private Short    percentage_        ;
  private Double   original_price     ;
  private Double   discount_price     ;
  private Double   price_1            ;
  private Double   price_2            ;
  private Double   nation_tax         ;
  private Double   location_tax       ;
  private Double   other_amount       ;
  private Double   delivery_charge    ;
  private Double   obtainable_gift_point ;
  private Double   deduct_gift_point  ;
  private Integer  last_payment_date  ;
  private Short    payment_progrss    ;
  private Short    payment_status     ;
  private Short    payment_times      ;
  private Double   recievable_amount  ;
  private Double   recieved_amount    ;
  private String   warehouse_code     ;
  private String   warehouse_type     ;
  private Long     consignee_number   ;
  private String   delivery_method    ;
  private Integer  shipment_date_1    ;
  private Integer  shipment_date_2    ;
  private Integer  shipment_date_3    ;
  private Integer  shipment_date_4    ;
  private Integer  shipment_date_5    ;
  private Short    shipment_progrss   ;
  private Short    shipment_status    ;
  private Short    shipment_times     ;
  private Integer  order_quantity     ;
  private Integer  shipped_quantity   ;
  private Integer  tna_quantity       ;
  private Short    returnable_flag    ;
  private Short    print_times        ;
  private String   cancel_region_code ;
  private String   cancel_shop_code   ;
  private String   cancel_terminal_code ;
  private String   cancel_staff_number ;
  private Integer  cancel_sale_date ;
  private Timestamp     cancel_timestamp ;
  private String   cancel_reason_code  ;
  private String   cancel_remark       ;
  private Integer  price_percentage ;
  
  
  @Transient
  private List<SalesOrderLine> lines ;
  @Transient
  private List<PaymentLine> paymentLines ;

  @Transient
  private CustomerProfile     subscriber  ;
  
  @Transient
  private CustomerProfile     consignee   ;
  
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
		if (this.lines != null) {
			for (SalesOrderLine line:lines) {
				line.setSales_order_id(id) ;
			}
		}
		if (this.paymentLines != null) {
			for (PaymentLine line:paymentLines) {
				line.setRef_id(id) ;
			}
		}
	}
	public Long getOid() {
		return oid;
	}
	public void setOid(Long uid) {
		this.oid = uid;
	}
	public String getRegion_code() {
		return region_code;
	}
	public void setRegion_code(String region_code) {
		this.region_code = region_code;
	}
	public String getShop_code() {
		return shop_code;
	}
	public void setShop_code(String shop_code) {
		this.shop_code = shop_code;
	}
	public String getTerminal_code() {
		return terminal_code;
	}
	public void setTerminal_code(String terminal_code) {
		this.terminal_code = terminal_code;
	}
	public String getStaff_number() {
		return staff_number;
	}
	public void setStaff_number(String staff_number) {
		this.staff_number = staff_number;
	}
	public Long getSubscriber_number() {
		return subscriber_number;
	}
	public void setSubscriber_number(Long subscriber_number) {
		this.subscriber_number = subscriber_number;
	}
	public Short getSubscriber_type() {
		return subscriber_type;
	}
	public void setSubscriber_type(Short subscriber_type) {
		this.subscriber_type = subscriber_type;
	}
	public String getChannel_() {
		return channel_;
	}
	public void setChannel_(String channel_) {
		this.channel_ = channel_;
	}
	public Short getType_() {
		return type_;
	}
	public void setType_(Short type_) {
		this.type_ = type_;
	}
	public Integer getSale_date() {
		return sale_date;
	}
	public void setSale_date(Integer sale_date) {
		this.sale_date = sale_date;
	}
	public Integer getPos_daily_seq() {
		return pos_daily_seq;
	}
	public void setPos_daily_seq(Integer pos_daily_seq) {
		this.pos_daily_seq = pos_daily_seq;
	}
	public Short getStatus_() {
		return status_;
	}
	public void setStatus_(Short status_) {
		this.status_ = status_;
		this.addInclusions("status_") ;
	}
	public Short getOrder_progrss() {
		return order_progrss;
	}
	public void setOrder_progrss(Short order_progrss) {
		this.order_progrss = order_progrss;
		this.addInclusions("order_progrss") ;
	}
	public Integer getPayer_number() {
		return payer_number;
	}
	public void setPayer_number(Integer payer_number) {
		this.payer_number = payer_number;
	}
	public Short getPercentage_() {
		return percentage_;
	}
	public void setPercentage_(Short percentage_) {
		this.percentage_ = percentage_;
	}
	public Double getOriginal_price() {
		return original_price;
	}
	public void setOriginal_price(Double original_price) {
		this.original_price = original_price;
		this.addInclusions("original_price") ;
	}
	public Double getDiscount_price() {
		return discount_price;
	}
	public void setDiscount_price(Double discount_price) {
		this.discount_price = discount_price;
		this.addInclusions("discount_price") ;
	}
	public Double getPrice_1() {
		return price_1;
	}
	public void setPrice_1(Double price_1) {
		this.price_1 = price_1;
		this.addInclusions("price_1") ;
	}
	public Double getPrice_2() {
		return price_2;
	}
	public void setPrice_2(Double price_2) {
		this.price_2 = price_2;
		this.addInclusions("price_2") ;
	}
	public Double getNation_tax() {
		return nation_tax;
	}
	public void setNation_tax(Double nation_tax) {
		this.nation_tax = nation_tax;
		this.addInclusions("nation_tax") ;
	}
	public Double getLocation_tax() {
		return location_tax;
	}
	public void setLocation_tax(Double location_tax) {
		this.location_tax = location_tax;
		this.addInclusions("location_tax") ;
	}
	public Double getOther_amount() {
		return other_amount;
	}
	public void setOther_amount(Double other_amount) {
		this.other_amount = other_amount;
		this.addInclusions("other_amount") ;
	}
	public Double getDelivery_charge() {
		return delivery_charge;
	}
	public void setDelivery_charge(Double delivery_charge) {
		this.delivery_charge = delivery_charge;
		this.addInclusions("delivery_charge") ;
	}
	public Double getObtainable_gift_point() {
		return obtainable_gift_point;
	}
	public void setObtainable_gift_point(Double obtainable_gift_point) {
		this.obtainable_gift_point = obtainable_gift_point;
		this.addInclusions("obtainable_gift_point") ;
	}
	public Double getDeduct_gift_point() {
		return deduct_gift_point;
	}
	public void setDeduct_gift_point(Double deduct_gift_point) {
		this.deduct_gift_point = deduct_gift_point;
		this.addInclusions("deduct_gift_point") ;
	}
	public Integer getLast_payment_date() {
		return last_payment_date;
	}
	public void setLast_payment_date(Integer last_payment_date) {
		this.last_payment_date = last_payment_date;
		this.addInclusions("last_payment_date") ;
	}
	public Short getPayment_progrss() {
		return payment_progrss;
	}
	public void setPayment_progrss(Short payment_progrss) {
		this.payment_progrss = payment_progrss;
		this.addInclusions("payment_progrss") ;
	}
	public Short getPayment_status() {
		return payment_status;
	}
	public void setPayment_status(Short payment_status) {
		this.payment_status = payment_status;
		this.addInclusions("payment_status") ;
	}
	public Short getPayment_times() {
		return payment_times;
	}
	public void setPayment_times(Short payment_times) {
		this.payment_times = payment_times;
		this.addInclusions("payment_times") ;
	}
	public Double getRecievable_amount() {
		return recievable_amount;
	}
	public void setRecievable_amount(Double recievable_amount) {
		this.recievable_amount = recievable_amount;
		this.addInclusions("recievable_amount") ;
	}
	public Double getRecieved_amount() {
		return recieved_amount;
	}
	public void setRecieved_amount(Double recieved_amount) {
		this.recieved_amount = recieved_amount;
		this.addInclusions("recieved_amount") ;
	}
	public String getWarehouse_code() {
		return warehouse_code;
	}
	public void setWarehouse_code(String warehouse_code) {
		this.warehouse_code = warehouse_code;
	}
	public String getWarehouse_type() {
		return warehouse_type;
	}
	public void setWarehouse_type(String warehouse_type) {
		this.warehouse_type = warehouse_type;
	}
	public Long getConsignee_number() {
		return consignee_number;
	}
	public void setConsignee_number(Long consignee_number) {
		this.consignee_number = consignee_number;
	}
	public String getDelivery_method() {
		return delivery_method;
	}
	public void setDelivery_method(String delivery_method) {
		this.delivery_method = delivery_method;
	}
	public Integer getShipment_date_1() {
		return shipment_date_1;
	}
	public void setShipment_date_1(Integer shipment_date_1) {
		this.shipment_date_1 = shipment_date_1;
		this.addInclusions("shipment_date_1") ;
	}
	public Integer getShipment_date_2() {
		return shipment_date_2;
	}
	public void setShipment_date_2(Integer shipment_date_2) {
		this.shipment_date_2 = shipment_date_2;
		this.addInclusions("shipment_date_2") ;
	}
	public Integer getShipment_date_3() {
		return shipment_date_3;
	}
	public void setShipment_date_3(Integer shipment_date_3) {
		this.shipment_date_3 = shipment_date_3;
		this.addInclusions("shipment_date_3") ;
	}
	public Integer getShipment_date_4() {
		return shipment_date_4;
	}
	public void setShipment_date_4(Integer shipment_date_4) {
		this.shipment_date_4 = shipment_date_4;
		this.addInclusions("shipment_date_4") ;
	}
	public Integer getShipment_date_5() {
		return shipment_date_5;
	}
	public void setShipment_date_5(Integer shipment_date_5) {
		this.shipment_date_5 = shipment_date_5;
		this.addInclusions("shipment_date_5") ;
	}
	public Short getShipment_progrss() {
		return shipment_progrss;
	}
	public void setShipment_progrss(Short shipment_progrss) {
		this.shipment_progrss = shipment_progrss;
		this.addInclusions("shipment_progrss") ;
	}
	public Short getShipment_status() {
		return shipment_status;
	}
	public void setShipment_status(Short shipment_status) {
		this.shipment_status = shipment_status;
		this.addInclusions("shipment_status") ;
	}
	public Short getShipment_times() {
		return shipment_times;
	}
	public void setShipment_times(Short shipment_times) {
		this.shipment_times = shipment_times;
		this.addInclusions("shipment_times") ;
	}
	public Integer getOrder_quantity() {
		return order_quantity;
	}
	public void setOrder_quantity(Integer order_quantity) {
		this.order_quantity = order_quantity;
		this.addInclusions("order_quantity") ;
	}
	public Integer getShipped_quantity() {
		return shipped_quantity;
	}
	public void setShipped_quantity(Integer shipped_quantity) {
		this.shipped_quantity = shipped_quantity;
		this.addInclusions("shipped_quantity") ;
	}
	public Short getReturnable_flag() {
		return returnable_flag;
	}
	public void setReturnable_flag(Short returnable_flag) {
		this.returnable_flag = returnable_flag;
	}
	public Short getPrint_times() {
		return print_times;
	}
	public void setPrint_times(Short print_times) {
		this.print_times = print_times;
		this.addInclusions("print_times") ;
	}
	public String getCancel_region_code() {
		return cancel_region_code;
	}
	public void setCancel_region_code(String cancel_region_code) {
		this.cancel_region_code = cancel_region_code;
		this.addInclusions("cancel_region_code") ;
	}
	public String getCancel_shop_code() {
		return cancel_shop_code;
	}
	public void setCancel_shop_code(String cancel_shop_code) {
		this.cancel_shop_code = cancel_shop_code;
		this.addInclusions("cancel_shop_code") ;
	}
	public String getCancel_terminal_code() {
		return cancel_terminal_code;
	}
	public void setCancel_terminal_code(String cancel_terminal_code) {
		this.cancel_terminal_code = cancel_terminal_code;
		this.addInclusions("cancel_terminal_code") ;
	}
	public String getCancel_staff_number() {
		return cancel_staff_number;
	}
	public void setCancel_staff_number(String cancel_staff_number) {
		this.cancel_staff_number = cancel_staff_number;
		this.addInclusions("cancel_staff_number") ;
	}
	public String getCancel_reason_code() {
		return cancel_reason_code;
	}
	public void setCancel_reason_code(String cancel_reason_code) {
		this.cancel_reason_code = cancel_reason_code;
		this.addInclusions("cancel_reason_code") ;
	}
	public String getCancel_remark() {
		return cancel_remark;
	}
	public void setCancel_remark(String cancel_remark) {
		this.cancel_remark = cancel_remark;
		this.addInclusions("cancel_remark") ;
	}
	public Integer getPrice_percentage() {
		return price_percentage;
	}
	public void setPrice_percentage(Integer price_percentage) {
		this.price_percentage = price_percentage;
		this.addInclusions("price_percentage") ;
	}
	public List<SalesOrderLine> getLines() {
		return lines;
	}
	public void setLines(List<SalesOrderLine> lines) {
		this.lines = lines;
	}
	public Integer getTna_quantity() {
		return tna_quantity;
	}
	public void setTna_quantity(Integer tna_quantity) {
		this.tna_quantity = tna_quantity;
		this.addInclusions("tna_quantity") ;
	}
    
    public Timestamp getOrder_timestamp() {
		return order_timestamp;
	}
	public void setOrder_timestamp(Timestamp order_timestamp) {
		this.order_timestamp = order_timestamp;
	}
	public Integer getCancel_sale_date() {
		return cancel_sale_date;
	}
	public void setCancel_sale_date(Integer cancel_sale_date) {
		this.cancel_sale_date = cancel_sale_date;
		this.addInclusions("cancel_sale_date") ;
	}
	public Timestamp getCancel_timestamp() {
		return cancel_timestamp;
	}
	public void setCancel_timestamp(Timestamp cancel_timestamp) {
		this.cancel_timestamp = cancel_timestamp;
		this.addInclusions("cancel_timestamp") ;
	}
	public List<PaymentLine> getPaymentLines() {
		return paymentLines;
	}
	public void setPaymentLines(List<PaymentLine> paymentLines) {
		this.paymentLines = paymentLines;
	}
	public CustomerProfile getSubscriber() {
		return subscriber;
	}
	public void setSubscriber(CustomerProfile subscriber) {
		this.subscriber = subscriber;
	}
	public CustomerProfile getConsignee() {
		return consignee;
	}
	public void setConsignee(CustomerProfile consignee) {
		this.consignee = consignee;
	}
	@Override
    public SalesOrder clone() throws CloneNotSupportedException {
    	return (SalesOrder)super.clone();
    }
}